// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IWorkScheduler.cs" company="AzureContrib (Open source library http://azurecontrib.codeplex.com)">
//   Microsoft Public License (Ms-PL)
// </copyright>
// <summary>
//   A scheduling algorithm that will order the available work tasks in a speciffic order.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;

namespace AzureContrib.WindowsAzure.WorkServices
{
	/// <summary>
	/// A scheduling algorithm that will order the available work tasks in a speciffic order.
	/// </summary>
	public interface IWorkScheduler
	{
		/// <summary>
		/// Order a set of <see cref="IWorkItem"/> in a speciffic order.
		/// </summary>
		/// <param name="works">The <see cref="IWorkItem"/> tasks to sort.</param>
		/// <returns>The <see cref="IWorkItem"/>s in a speciffic order.</returns>
		[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "In this very special case we need to consider a lazy piece of work as one unit. This unfortunately leads to nested generics.")]
		IOrderedEnumerable<Lazy<IWork>> ScheduleWork(IEnumerable<Lazy<IWork>> works);
	}
}